import Vue from 'vue'
import VueRouter from 'vue-router'


Vue.use(VueRouter)
//path需要手动添加


const routes = [
  {
    path: '/',
    redirect: '/saleSystem', //重定向
  },

  // 销售员路由
  {
    path: '/saleSystem',//销售员中心
    name: 'saleSystem',
    component: () => import('../views/saleSystem.vue'),
    children: [
      // ==============订单============
      {
        path: '/Orderlist',//订单列表
        name: 'Orderlist',
        component: () => import('../components/orders/Orderlist'),
      },
      {
        path: '/Order',//查看订单
        name: 'Order',
        component: () => import('../components/orders/Order'),
      },
      {
        path: '/Updateorder',//修改订单
        name: 'Updateorder',
        component: () => import('../components/orders/Updateorder'),
      },
      {
        path: '/Cancellation',//取消订单
        name: 'Cancellation',
        component: () => import('../components/orders/Cancellation'),
      },
      //  ========= 理赔========
      {
        path: '/Change',//理赔修改
        name: 'Change',
        component: () => import('../components/lipei/Change'),
      },
      {
        path: '/Lipeilist',//理赔列表
        name: 'Lipeilist',
        component: () => import('../components/lipei/Lipeilist'),
      },
      {
        path: '/Uploadimg',//上传理赔凭证
        name: 'Uploadimg',
        component: () => import('../components/lipei/Uploadimg'),
      },
      //  ======客户=======
      {
        path: '/Addcustomers',//添加客户
        name: 'Addcustomers',
        component: () => import('../components/clients/Addcustomers'),
      },
      {
        path: '/Customerslist',//客户列表
        name: 'Customerslist',
        component: () => import('../components/clients/Customerslist'),
      },

      {
        path: '/Updatecustomers',//修改客户
        name: 'Updatecustomers',
        component: () => import('../components/clients/Updatecustomers'),
      },
      //  =====个人中心======
      {
        path: '/Changepwd',//修改密码
        name: 'Changepwd',
        component: () => import('../components/Application/Changepwd'),
      },
      {
        path: '/Updatepersonal',//修改个人信息
        name: 'Updatepersonal',
        component: () => import('../components/Application/Updatepersonal'),
      },

      // ==============订单============
      {
        path: '/Orderlist',//订单列表
        name: 'Orderlist',
        component: () => import('../components/orders/Orderlist'),
      },
      {
        path: '/Order',//查看订单
        name: 'Order',
        component: () => import('../components/orders/Order'),
      },
      {
        path: '/Updateorder/:_id',//修改订单
        name: 'Updateorder',
        component: () => import('../components/orders/Updateorder'),
      },
      {
        path: '/Cancellation',//取消订单
        name: 'Cancellation',
        component: () => import('../components/orders/Cancellation'),
      },
      //  ========= 理赔========
      {
        path: '/Change',//理赔修改
        name: 'Change',
        component: () => import('../components/lipei/Change'),
      },
      {
        path: '/Lipeilist',//理赔列表
        name: 'Lipeilist',
        component: () => import('../components/lipei/Lipeilist'),
      },
      {
        path: '/Uploadimg',//上传理赔凭证
        name: 'Uploadimg',
        component: () => import('../components/lipei/Uploadimg'),
      },
      //  ======客户=======
      {
        path: '/Addcustomers',//添加客户
        name: 'Addcustomers',
        component: () => import('../components/clients/Addcustomers'),
      },
      {
        path: '/Customerslist',//客户列表
        name: 'Customerslist',
        component: () => import('../components/clients/Customerslist'),
      },

      {
        path: '/Updatecustomers/:_id',//修改客户
        name: 'Updatecustomers',
        component: () => import('../components/clients/Updatecustomers'),
      },
      //  =====个人中心======
      {
        path: '/Changepwd',//修改密码
        name: 'Changepwd',
        component: () => import('../components/Application/Changepwd'),
      },
      {
        path: '/Updatepersonal',//修改个人信息
        name: 'Updatepersonal',
        component: () => import('../components/Application/Updatepersonal'),
      },


    ]
  },



  // 管理员路由
  {
    path: '/home',
    name: 'Home',
    component: () => import('../components/Home'),
    children: [
      //  Insurance
      {
        path: '/productlist',
        name: 'productlist',
        component: () => import('../components/admin/Insuranceproduct/productlist')
      },
      {
        path: '/addproduct',
        name: 'addproduct',
        component: () => import('../components/admin/Insuranceproduct/addproduct')
      },
      {
        path: '/modifyaprofuct:_id',
        name: 'modifyaprofuct',
        component: () => import('../components/admin/Insuranceproduct/modifyaprofuct')
      },

      {
        path: "/AddAdmin",
        name: "AddAdmin",
        component: () => import("../components/admin/Administrator/addadmin.vue")
      },
      {
        path:'/insurancelist',
        name:'/Insurancelist',
        component:()=>import('../components/admin/Insuranceclassification/insurancelist.vue')
      },
      {
        path:'/addinsurance',
        name:'/Addinsurance',
        component:()=>import("../components/admin/Insuranceclassification/addinsurance.vue")
      },
      {
        path:'/modiinsurancer/:_id',
        name:'/Modiinsurancer',
        component:()=>import("../components/admin/Insuranceclassification/modiinsurancer.vue")
      },
        //销售员增删改
        {
          path:'/AddSales',
          name:'AddSales',
          component:() => import("../components/admin/salesmanagement/addsales.vue")
        },
        {
          path:'/SalesList',
          name:'SalesList',
          component:() => import("../components/admin/salesmanagement/saleslist.vue")
        },
        //修改页面
        {
          path:'modifyasales/:_id',
          name:'Modifyasales',
          component:() =>import("../components/admin/salesmanagement/modifyasales.vue")
        },
    ]
  }
]

const router = new VueRouter({
  routes
})

export default router
